package com.mms.pojo;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by dangz on 2017/5/18/018.
 */
@Entity
@Table(name = "sys_menu")
public class SysMenu implements Serializable {
    private Long id;
    private String name;
    private String remark;
    private String img;
    private String param;
    private String addTime;
    private String updateTime;
    private Integer status;
    private Integer ordno;
    private String scort;//1.2
    private SysMenu sysMenu;
    private Set<SysOperate> sysOperates = new HashSet<SysOperate>(0);
    private Set<SysMenu> sysMenus = new HashSet<SysMenu>(0);

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Column(name = "img")
    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getParam() {
        return param;
    }

    @Column(name = "param")
    public void setParam(String param) {
        this.param = param;
    }

    @Column(name = "addTime")
    public String getAddTime() {
        return addTime;
    }

    public void setAddTime(String addTime) {
        this.addTime = addTime;
    }

    @Column(name = "updateTime")
    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PID")
    public SysMenu getSysMenu() {
        return this.sysMenu;
    }

    public void setSysMenu(SysMenu sysMenu) {
        this.sysMenu = sysMenu;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "sysMenu")
    @OrderBy("ordno")
    public Set<SysOperate> getSysOperates() {
        return this.sysOperates;
    }

    public void setSysOperates(Set<SysOperate> sysOperates) {
        this.sysOperates = sysOperates;
    }

    @OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY, mappedBy = "sysMenu")
    @OrderBy("ordno")
    public Set<SysMenu> getSysMenus() {
        return this.sysMenus;
    }

    public void setSysMenus(Set<SysMenu> sysMenus) {
        this.sysMenus = sysMenus;
    }

    public Integer getOrdno() {
        return ordno;
    }

    @Column(name = "ordno")
    public void setOrdno(Integer ordno) {
        this.ordno = ordno;
    }

    @Column(name = "scort")
    public String getScort() {
        return scort;
    }

    public void setScort(String scort) {
        this.scort = scort;
    }
}
